//数据交互

//获取页面url参数
var c2;
function getParam(){
	var c1;
	c1 = window.location.href.split("?")[1];
	c2 = c1.split("=")[1];
	getData(c2);
}
getParam();
function getData(param){
//	console.log(param);
//	console.log('c2'+c2);
	var mess_url = '/citrusmonitor/law.do?method=findById&'+'lawId='+param;//后台填充
	$.ajax({
		type:'get',
		url:mess_url,
		dataType:'json',
		success:function(data){
			
			var title_box = document.getElementsByClassName("title_box")[0];
			var content_box = document.getElementsByClassName("content_box")[0];
			var html_tit = '';
			var html_con = '';
			//border:3px black solid;
			html_tit = '<h1 class="title">'+data["tittle"]+'</h1><div class="title_detail"><span class="time"><span>发布时间：</span><span>'+data["publishTime"]+'</span></span><span class="source"><span>  来源：</span><span>'+data["source"]+'</span></span></div>';
			html_con ='<div style="width:480px;margin:0 auto">'+data["content"]+'</div>';
			//'<img src="'+data["filePath"]+'">'+
			title_box.innerHTML=html_tit;
			content_box.innerHTML=html_con;
			download();
		},
		error:function(){
			alert("资源加载失败！！");
		}
	});
}
//下载按钮
function download(){
//	console.log(c2);
	var down_btn = document.getElementsByClassName("down_btn")[0];
	var mess_url = '/citrusmonitor/law.do?method=download&'+'lawId='+c2;
	//var path='/citrusmonitor/law.do?method=download&'+'lawId'=param;
	down_btn.onclick =function(){
		window.location.href=mess_url;
	}
	
	
}
